<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class SchoolController extends CController{
    
    public function actionIndex(){
        
        $Letter =array('A','B','C','D');
        $sqlSchool ="SELECT id,name,initials FROM xyh_school WHERE `status` =1 AND type_id=1 ORDER BY initials  ";
        $dataSchool = Yii::app()->db->createCommand($sqlSchool)->queryAll();  
        
        foreach ($dataSchool as $k=>$v){
            $dataSchool[$v['initials']][] =$v;
            unset($dataSchool[$k]);
        }
        
        //合作院校
           $sqlRightList ="SELECT a.id,city_id,s.name,a.banner_url
                          FROM xyh_alumni as a
                          LEFT JOIN xyh_school as s on s.id = a.school_id
                          WHERE a.status = 1 and a.is_del=2 and a.parent_id<>0  LIMIT 13";

           $dataRightList['school'] = Yii::app()->db->createCommand($sqlRightList)->queryAll();
        
       // p_e($dataSchool);
        $this->render('index',array('School'=>$dataSchool,'dataRightList'=>$dataRightList));
        
    }
    
    
}